<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8"/>
    <div th:replace="config :: copy"></div>
</head>
<body>
<fieldset class="layui-elem-field site-demo-button" style="margin-top: 20px;">
    <legend style="font-size: smaller;">查询条件</legend>
    <div>
        <form class="layui-form" th:action="@{list}" th:object="${userSelect}" target="myFrameName" id="userSubmit">
            <!--<div class="layui-inline">-->
            <!--<label class="layui-form-label">用户名：</label>-->
            <!--<div class="layui-input-block">-->
            <!--<input type="text" name="title" lay-verify="title" autocomplete="off" placeholder="用户名" class="layui-input">-->
            <!--</div>-->
            <!--</div>-->
            <div class="layui-inline" >
                <label class="layui-form-label">姓名：</label>
                <div class="layui-input-block">
                    <input type="text" name="userName" id="userName" placeholder="用户名"  th:field="*{userName}" autocomplete="off" class="layui-input"/>
                </div>
            </div>
            <input type="hidden" id="indexPage" name="indexPage" th:value="1"/>
            <input type="hidden" id="pageSize" name="pageSize" th:value="10"/>
            <button class="layui-btn layui-btn-normal" style="margin-left: 200px;" lay-submit="" lay-filter="userSelect">查询</button>
            <div class="layui-btn layui-btn-normal" style ="margin-left: 50px;" onclick="insertUser('add')">添加</div>
        </form>

    </div>
    <br/>
</fieldset>
<div class="layui-tab-item layui-show">
    <iframe name="myFrameName" style="width: 100%; height: 750px;" frameborder="0"></iframe>
</div>
<div id="pagePlug" class="layui-footer"></div>

<script >
    function insertUser(flag){
        console.log('flag-->'+flag)
        layer.open({
            type: 2,
            title: '用户管理',
            area: ['700px', '450px'],
            fixed: false, //不固定
            maxmin: true,
            content: 'edit?id=-1&amp;flag='+flag+''
        })
    }
        layui.use(['form','layer'], function(){
            var form = layui.form;
            var $ = layui.jquery
            //自动加载
            $("#userSubmit").submit();

            //监听提交
            form.on('submit(userSelect)', function(data){
//                layer.alert(JSON.stringify(data.field) )
            });



        })
</script>


</body>
</html>